import { RouteRecordRaw } from 'vue-router'
import DefaultLayout from '@/layout/default-layout.vue'
import { renderSvgIcon } from '@/utils/tools'

export const NotFoundRoute: RouteRecordRaw = {
  path: '/:path(.*)*',
  name: '404',
  component: () => import('@/views/exception/404.vue'),
  meta: {
    title: '404',
    hidden: true,
    requiresAuth: false
  }
}

export const HomeRoute: RouteRecordRaw = {
  path: 'home',
  name: 'Home',
  component: () => import('@/views/dashboard/index.vue'),
  meta: {
    title: '主页',
    icon: 'icon-home',
    hidden: false,
    order: 0
  }
}

export const ApiRoute: RouteRecordRaw = {
  path: '/:groupName/:controller/:summary/:operationId',
  component: () => import('@/views/document/index.vue'),
  props: true,
  meta: {
    hidden: false,
    order: 0
  }
}

export const ModelsRoute: RouteRecordRaw = {
  path: 'models',
  name: 'Models',
  component: () => import('@/views/models/index.vue'),
  meta: {
    title: 'Swagger Models',
    icon: renderSvgIcon('model'),
    hidden: false,
    order: 1
  }
}

export const AuthRoute: RouteRecordRaw = {
  path: 'auth',
  name: 'Authorize',
  component: () => import('@/views/authorize/index.vue'),
  meta: {
    title: 'Authorize',
    icon: renderSvgIcon('auth'),
    hidden: false,
    order: 2
  }
}

export const RootRoute: RouteRecordRaw = {
  path: '/',
  name: 'Root',
  component: DefaultLayout,
  redirect: '/home',
  children: [HomeRoute, ApiRoute]
}

export const ROOT_TAG_NAME = 'Root'
export const ROOT_TAG_PATH = '/'
